<!DOCTYPE html>
<html>
    <meta charset="utf-8">
    <title>FlyProduct</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" type="text/css" href="/public/bootstrap/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" type="text/css" href="/public/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/public/bootstrap/css/bootstrap-datetimepicker.min.css">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }
    </style>

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->



</head>    
<body>
    <?php if ($this->error == 1): ?>
        <div class="alert alert-success">
            Update done.
        </div>
    <?php elseif ($this->error == -110): ?>
        <div class="alert alert-error">
            Update fail, please check your data.
        </div>
    <?php endif; ?>
    <?php echo $this->render('tool/navmenu.phtml') ?>


    <div class="container-fluid">
        
            <legend>Video database</legend>
             <?php if (!empty($this->video)): ?>        
            <table class="table table-bordered">
               
                    <thead>
                        <tr>
                            <th>id</th>
                            <th>Title</th>
                            <th>Link</th>
                            <th style="width: 15px">Thumbnail</th>
                            <th style="width: 15px">Image</th>
                            <th>Type</th>                            
                            <th>Action</th>
                            <th>Action</th>
                            <th>Update time</th>
                            <th>Creator</th>
                        </tr>
                    </thead>
                    <tbody >
                        <?php foreach ($this->video as $value): ?>
                            <tr>
                                <td><?php echo $value['id'] ?></td>
                                <td><?php echo $value['title'] ?></td>
                                <td><?php echo $value['link'] ?></td>
                                <td style="width: 15px">
                                    <?php echo $value['thumb'] ?>
                                    <a href="<?php echo $value['thumb'] ?>">Click to full view</a>
                                </td>
                                <td><img src="<?php echo $value['thumb'] ?>" style="width: 50px;height: 50px"</td>
                                <td>
                                            <?php
                                            if ($value['video_type'] == 1) {
                                                echo '<span class="label label-success">Short clip</span>';
                                            } else if ($value['video_type'] == 2) {
                                                echo '<span class="label label-info">Music video</span>';
                                            } else if ($value['video_type'] == 3) {
                                                echo '<span class="label">Film</span>';
                                            }
                                            ?>
                                        </td>
                                
                                <td>
                                    <form action="/public/tool/videodelete" >
                                        <input type="hidden" value="<?php echo $value['id'] ?>" name="id" />
                                        <button class="btn btn-danger" type="submit" >Delete</button>
                                    </form>
                                </td>
                                <td>
                                    <form action="/public/tool/videoupdate" >
                                        <input type="hidden" value="<?php echo $value['id'] ?>" name="id" />
                                        <button class="btn btn-warning" >Update</button>
                                    </form> 
                                </td>
                                <td><?php echo $value['create_time'] ?></td>
                                <td><?php echo $value['admin'] ?></td>
                            </tr>
                                <?php endforeach; ?>      
                        </tbody>
                    <?php endif; ?>
                        <?php if (!empty($this->page) && !empty($this->curren_page)): ?>    
                            <div class="pagination">
                                <ul>
                                    <?php for ($i = 1; $i <= $this->page; $i++): ?>
                                        <li class=<?php
                                if ($i == $this->curren_page) {
                                    echo 'disabled';
                                }
                                        ?> >
                                            <a href='/public/tool/viewvideo?page=<?php echo $i ?>'>
                                                <?php echo $i ?>
                                            </a></li>
                                    <?php endfor; ?>            
                                </ul>
                            </div>                    
                       
            </table>
            <?php else: ?>
                <div class="alert alert-info">
                    Database is empty.
                </div>
            <?php endif; ?>
        
    </div>
</body>
</html>



